<html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:v="http://corejsf.com/validator">

<f:view>
<f:loadBundle var="text" basename="#{questionForm.bundleName}"/>
    <head>
        <title>#{text['questionDetail.title']}</title>
        <meta name="heading" content="#{text['questionDetail.heading']}"/>
        <style type="text/css">
            .jscalendar-DB-div-style {
                position: absolute;
                margin-top: -120px;
                margin-left: -508px;
            }
    </style>    
    </head>
<body id="questionForm" >

<h:form id="questionForm" onsubmit="return validateQuestionForm(this)" >
<h:inputHidden value="#{questionForm.question.questionId}" id="questionId"/>
<h:panelGrid columns="3">

	<h:outputLabel styleClass="desc" for="questionnaries" value="#{text['questionForm.questionnaire']}"/>
    <h:selectOneListbox id="questionnaire" value="#{questionForm.questionnaire.questionnaireId}" styleClass="large">
     <f:selectItems id="questionnaries_options" value="#{questionForm.questionarios}" />
    </h:selectOneListbox>
	
    <h:outputLabel styleClass="desc" for="description" value="#{text['question.description']}"/>
    <t:message for="description" styleClass="fieldError"/>
    <h:inputTextarea styleClass="text large" id="description" value="#{questionForm.question.description}" required="false" maxlength="255"  /><p/>

    <h:panelGroup styleClass="buttonBar bottom">
        <h:commandButton value="#{text['button.save']}" action="#{questionForm.save}" id="save" styleClass="button"/>

        <c:if test="${not empty questionForm.question.questionId}">
        <h:commandButton value="#{text['button.delete']}" action="#{questionForm.delete}"
            id="delete" styleClass="button" onclick="bCancel=true; return confirmDelete('Question')"/>
        </c:if>

        <h:commandButton value="#{text['button.cancel']}" action="questionList" immediate="true"
            id="cancel" styleClass="button" onclick="bCancel=true"/>
    </h:panelGroup>
    <h:outputText/><h:outputText/>
</h:panelGrid>
</h:form>

<v:validatorScript functionName="validateQuestionForm"/>

<script type="text/javascript">
    //Form.focusFirstElement($('questionForm'));
    highlightFormElements(); 
</script>

</body>
</f:view>
</html>
